﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace homework1WinForm
{
    public partial class Form1:Form
    {
        public Form1()
        {
            InitializeComponent();
            this.teacherComboBox.SelectedIndex=0;
        }


        private void ShowResult()
        {
            String course="";
            if(chineseCheckBox.Checked)
                course+=chineseCheckBox.Text+"、";
            if(mathCheckBox.Checked)
                course+=mathCheckBox.Text+"、";
            if(englishCheckBox.Checked)
                course+=englishCheckBox.Text+"、";
            course=course.TrimEnd('、');
            if(resultTextLabel!=null)
                resultTextLabel.Text=$"教师：{teacherComboBox.Text}  ,  课程：{course}";
        }

        private void teacherComboBox_SelectedIndexChanged(object sender,EventArgs e)
        {
            ShowResult();
        }

        private void redRadioButton_CheckedChanged(object sender,EventArgs e)
        {
            resultTextLabel.ForeColor=Color.Red;
        }

        private void blueRadioButton_CheckedChanged(object sender,EventArgs e)
        {
            resultTextLabel.ForeColor=Color.Blue;
        }

        private void blackRadioButton_CheckedChanged(object sender,EventArgs e)
        {
            resultTextLabel.ForeColor=Color.Black;
        }

        private void chineseCheckBox_CheckedChanged(object sender,EventArgs e)
        {
            ShowResult();
        }

        private void mathCheckBox_CheckedChanged(object sender,EventArgs e)
        {
            ShowResult();
        }

        private void englishCheckBox_CheckedChanged(object sender,EventArgs e)
        {
            ShowResult();
        }
    }
}